package com.itheima.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;

/*
@RestController等于@Controller,@ResponseBody两个注解,注解为止在controller类上,相当于整个类中所有方法的返回值都为json字符串
 */
@RestController
public class HelloController {
//    @GetMapping("hello")
    @Autowired
    public DataSource dataSource;
    @Value("${itcast.url}")
    private String itcastUrl;
    @Value("${itheima.url}")
    private String itheimaUrl;

    @RequestMapping("hello")
    public String hello(){
        System.out.println("dataSource = " + dataSource);
        System.out.println("itcast =" + itcastUrl);
        System.out.println("itheima =" + itheimaUrl);
        return "hello, spring boot2222!";
    }
}
